<script setup>
import { defineEmits,ref, watch } from 'vue'

const props = defineProps({
    title: String,
    width: String,
    isdialog: {
        type: Boolean,
        default: false
    }
})

// const isshow=props.isdialog
// 实现在关闭子组件的时候更新父组件中的isdialog
const isshow = ref(props.isdialog)
watch(()=>props.isdialog,()=>{
    console.log(props.isdialog);
    isshow.value=props.isdialog
})



const emit = defineEmits(['cancel','comfirm'])
const comfirm = ()=>{
    emit('comfirm')
}
</script>

<template>
    <el-dialog  v-model="isshow" :title="props.title"
        :width="props.width">
        <slot></slot>
        <template #footer>
            <div class=" dialog-footer">
                <el-button @click="emit('cancel')">取消</el-button>
                <el-button type="primary" @click="comfirm">
                    确定
                </el-button>
            </div>
        </template>
    </el-dialog>
</template>

<style lang="scss" scoped>
</style>